var n=0;
cc.Class({
    extends: cc.Component,

    properties: {
      button_1: cc.Button,
      button_2: cc.Button,
      button_3: cc.Button,
      button_4: cc.Button,
      button_5: cc.Button,
      button_6: cc.Button,
      button_7: cc.Button,
      button_8: cc.Button,
      button_9: cc.Button,
      label:cc.Label,
    },
   onClickedButton_1: function() {
       var button= this.button_1.getComponent(cc.Button)
       var bool1=this.button_1.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },

   onClickedButton_2: function() {
       var button= this.button_2.getComponent(cc.Button)
       var bool1=this.button_2.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_3: function() {
       var button= this.button_3.getComponent(cc.Button)
       var bool1=this.button_3.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_4: function() {
       var button= this.button_4.getComponent(cc.Button)
       var bool1=this.button_4.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_5: function() {
       var button= this.button_5.getComponent(cc.Button)
       var bool1=this.button_5.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_6: function() {
       var button= this.button_6.getComponent(cc.Button)
       var bool1=this.button_6.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_7: function() {
       var button= this.button_7.getComponent(cc.Button)
       var bool1=this.button_7.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_8: function() {
       var button= this.button_8.getComponent(cc.Button)
       var bool1=this.button_8.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
        onClickedButton_9: function() {
       var button= this.button_9.getComponent(cc.Button)
       var bool1=this.button_9.getComponent('NewScript').bool
       var lable=this.label.getComponent(cc.Label)
       if(bool1==false)
       {button.normalColor=new cc.Color(255, 0, 0, 128);
        n--;
       lable.string='分数为：'+n
      }
       else
       {button.normalColor=new cc.Color(255, 255, 255, 128);
        n++;
         lable.string='分数为：'+n
      }
     },
 

    // use this for initialization
    onLoad: function () {

    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
